Repository navigation
infra: fleet-paperwork — file GitHub issues as the developing.today App - #3692
Conversation
Bulk fleet bookkeeping through a user token tripped GitHub's per-actor secondary rate limit on 2026-11-01, and two gh creates silently created nothing. fleet_paperwork.py authenticates as the developing.today GitHub App (separate installation-token bucket), resolves the installation by repo owner, dedupes creates by exact title, paces writes via a local ledger, and verifies every create/comment/close by readback. First live use filed the three pending items: opencode#1280 (preserved-branch decision issue for rescue/3041-631-subagent-ancestor-2026-11-01), the resolution comment + close on opencode#1203, and code#3691 (the audit gap: queue/3201-2167-shebang-dispatch).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 240bab3158
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| q = urllib.parse.quote(f'repo:{repo} "{title}"') | ||
| _, data = http("GET", f"/search/issues?q={q}&per_page=20", token) | ||
| for item in data.get("items", []): | ||
| if item.get("title") == title: |
There was a problem hiding this comment.
Exclude pull requests from issue deduplication
If a pull request already has the requested title, this lookup accepts it as an existing issue, and cmd_create returns success without filing the requested issue. GitHub's search endpoint searches both issues and pull requests, but neither the query nor the exact-title filter excludes PRs. Add is:issue to the query or reject results containing pull_request before treating them as dedupe hits.
Useful? React with 👍 / 👎.
| _, data = http("GET", f"/search/issues?q={q}&per_page=20", token) | ||
| for item in data.get("items", []): | ||
| if item.get("title") == title: | ||
| return item | ||
| return None |
There was a problem hiding this comment.
Check subsequent search pages before creating another issue
When more than 20 results match the search phrase, an existing exact-title issue can fall outside the first page because the query also matches longer titles and body text. This function then returns None, causing a rerun to create a duplicate despite deduplication being enabled. Follow the search pagination before declaring the title absent, and narrow the query with in:title to reduce unrelated matches.
Useful? React with 👍 / 👎.
| _, got = http("GET", f"/repos/{args.repo}/issues/{number}", token) | ||
| if got.get("title") != title or got.get("number") != number: | ||
| die(f"readback mismatch for {args.repo}#{number}: " | ||
| f"title={got.get('title')!r}") |
There was a problem hiding this comment.
Compare the issue body during create readback
If readback returns the expected number and title but an empty or altered body, this condition still accepts the filing, records it in the ledger, and prints created+verified. A subsequent rerun also skips the issue through title deduplication, leaving the missing paperwork content undetected. This contradicts the documented verified-or-failed contract; compare the returned body against the submitted body, as cmd_comment already does.
Useful? React with 👍 / 👎.
| def ledger_append(action: str, repo: str, number: str, detail: str) -> None: | ||
| path = ledger_path() | ||
| path.parent.mkdir(parents=True, exist_ok=True) | ||
| ts = datetime.now(timezone.utc).isoformat(timespec="seconds") |
There was a problem hiding this comment.
Preserve subsecond precision in the pacing ledger
When successive invocations run within the configured pacing interval, truncating the ledger timestamp to whole seconds lets the next write proceed almost a second early: a write recorded at epoch 100.9 becomes 100, so an immediate pace(3) waits only 2.1 seconds. This also makes test_pace_waits_remainder nondeterministically fail its minimum-duration assertion; running the unchanged test at fractional second 0.8 reproduced a roughly 0.2-second wait against its 0.4-second minimum. Preserve fractional seconds in the stored timestamp so pacing measures the actual elapsed interval.
Useful? React with 👍 / 👎.
| if len(seen) >= data.get("total_count", 0) or not data.get("repositories"): | ||
| break | ||
| page += 1 | ||
| if repo not in seen: |
There was a problem hiding this comment.
Compare repository scope names case-insensitively
When --repo uses different capitalization from the installation's canonical full_name, such as Developing-Today/code instead of developing-today/code, this check rejects the authorized repository and prevents every command from proceeding. GitHub documents both owner and repository names as case-insensitive, and installation_for() already compares owner logins that way. Normalize both sides of the scope membership check rather than requiring canonical capitalization.
Useful? React with 👍 / 👎.
What
Adds
infra/fleet-paperwork/fleet_paperwork.py: a small CLI that files GitHub issues/comments/closes as thedeveloping.todayGitHub App instead of as a user token.~/secrets/pm-stack.sops.yaml, referenced by key name only — no credential values in the repo) → RS256 JWT (openssl) → per-owner installation token, installation resolved live by repo-owner login (org install fordeveloping-today/*, personal fordezren39/nix); repo scope confirmed before any write.ghtripped the user token's secondary rate limit, and two creates returned exit 0 while creating nothing (one batch issue was later found missing by audit). An App installation token is a separate actor with its own rate-limit bucket.~/.local/state/fleet-paperwork/ledger.tsv).Live proof (already filed through the App, authored
app/developing-today)rescue/3041-631-subagent-ancestor-2026-11-01queue/3201-2167-shebang-dispatch, closing the one miss found byissue-pr-audit-2026-11-01Tests
python3 -m unittest discover -s infra/fleet-paperwork/tests— 7/7 pass (run on the laptop; pure functions, no network).fleet_paperwork.py check --repo developing-today/codeand--repo developing-today/opencode— live read-only check passes; the laptop copy used for the filings was sha256-identical to the script in this PR.Need help on this PR? Tag
@codesmith-botwith what you need.